package com.psytech.app.task.web_ui;

import java.util.Date;

/**
 * Object that embed the necessary informations about a task for the use of
 * Taskman.
 */
public class Task {

	public static enum PRIORITY {
		LOW, MEDIUM, HIGH
	}

	public static enum STATUS {
		PENDING, PROGRESS, STANDBY, COMPLETE
	}

	private String uid;
	private String name;
	private String description;
	private PRIORITY priority;
	private STATUS status;
	private String creatorUid;
	private String assignedUserUid;
	private String projectUid;
	private Date expectedEndDate;
	private Date expectedStartDate;

	/**
	 * Get the unique task id.
	 * 
	 * @return the task Uid
	 */
	public String getUid() {
		return this.uid;
	}

	/**
	 * Set the uid.
	 * 
	 * @param uid
	 *            the uid to set
	 */
	public void setUid(final String uid) {
		this.uid = uid;
	}

	/**
	 * Get the name of the task.</br> The name is a short description of the
	 * task.
	 * 
	 * @return the task name
	 */
	public String getName() {
		return this.name;
	}

	/**
	 * Set the name of the task.
	 * 
	 * @param name
	 *            the name to set
	 */
	public void setName(final String name) {
		this.name = name;
	}

	/**
	 * Get the complete description of the task.
	 * 
	 * @return the task description
	 */
	public String getDescription() {
		return this.description;
	}

	public PRIORITY getPriority() {
		return this.priority;
	}

	public void setPriority(final PRIORITY priority) {
		this.priority = priority;
	}

	public STATUS getStatus() {
		return this.status;
	}

	public void setStatus(final STATUS status) {
		this.status = status;
	}

	/**
	 * Get the uid of the user whom create this task.
	 * 
	 * @return the creator uid
	 */
	public String getCreatorUid() {
		return this.creatorUid;
	}

	public void setCreatorUid(final String creatorUid) {
		this.creatorUid = creatorUid;
	}

	/**
	 * Get the user uids list of users affected to the task.
	 * 
	 * @return user uids list
	 */
	public String getAssignedUserUid() {
		return this.assignedUserUid;
	}

	public void setAssignedUserUid(final String assignedUserUid) {
		this.assignedUserUid = assignedUserUid;
	}

	public void setDescription(final String description) {
		this.description = description;
	}

	public String getProjectUid() {
		return this.projectUid;
	}

	public void setProjectUid(final String projectUid) {
		this.projectUid = projectUid;
	}

	public Date getExpectedEndDate() {
		return this.expectedEndDate;
	}

	public void setExpectedEndDate(final Date expectedEndDate) {
		this.expectedEndDate = expectedEndDate;
	}

	public Date getExpectedStartDate() {
		return this.expectedStartDate;
	}

	public void setExpectedStartDate(final Date expectedStartDate) {
		this.expectedStartDate = expectedStartDate;
	}

	@Override
	public boolean equals(final Object obj) {
		if (this == obj)
			return true;
		if (obj instanceof Task) {
			if (this.getUid().equals(((Task) obj).getUid()))
				return true;
		}
		return false;

	}

	@Override
	public int hashCode() {
		return this.getUid() != null ? this.getUid().hashCode() : 1;
	}
}
